<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>
    class Person {
        constructor(name, age) {
            this.name = name;
            this.age = age;
        }
        skill() {
            console.log("thinking");
        }
        say() {
            console.log(this.name, this.age);
        }
    }
    Person.prototype.species = "human";
    console.log(new Person("张三",28));

    // 除了继承父类 实例的属性和方法 原型对象上的属性和方法  还想定义自己的
    class YellowPerson extends Person {
        // 定义自己 实例的属性和方法   
        // (1) 必须先调用父类构造函数 super() 在定义自己的  实例的属性和方法
        constructor(name, age, hobby) {
            super(name, age);
            this.hobby = hobby;
        }

        speak() {
            console.log("chinses");
        }
        say() {
            console.log(this.name, thia.age, this.hobby);
        }
    }

    console.log(new YellowPerson("张三",18,"篮球"));
</script>

</html>